VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "Integration"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
'Project Name:  Array
'Host Name:     Array.Integration
'Date:          2004-01-01
'Version:
'Author:        Joseph Weir
'

Option Explicit

Private WithEvents m_objHotKeyCloseConnection As FSIX.HotKey
Attribute m_objHotKeyCloseConnection.VB_VarHelpID = -1
Private m_intUserFormType As Integer
'

'---------------------------------------------------------------------------------------
' Procedure : Integration_Main
' DateTime  : 12/19/2006
' Purpose   : Initializes all host objects
'---------------------------------------------------------------------------------------
'
Private Sub Integration_Main()

    On Error GoTo Integration_Main_Error

    ' Set Host Language
    Call InitializeLanguageSupport
 
    ' Enable ODBC Close Connection Hot Key
    Set m_objHotKeyCloseConnection = New FSIX.HotKey
 
    With m_objHotKeyCloseConnection
        .Key = "{F6}"
        .ExtenderKey = fsiAltKey
        .Enabled = True
    End With

    ' Set User Form type
    UserFormType = -1

    ' Show Entry Box Form
    If False Then
        Set g_formEntryBox = New frmEntryBox
        Call ShowEntryBox
    End If
 
    ' Monitor all hosts
    HostItems.Monitor

Release:
    ' Release ODBC Close Connection Hot Key
    Call m_objHotKeyCloseConnection_HotKeyPressed
    m_objHotKeyCloseConnection.Enabled = False
    Set m_objHotKeyCloseConnection = Nothing

    ' Unload g_formentryBox
    On Error Resume Next
    Unload g_formEntryBox
    Set g_formEntryBox = Nothing
    Unload g_formArrayBatch
    Set g_formArrayBatch = Nothing
    Unload g_formCotyBatch
    Set g_formCotyBatch = Nothing

    Exit Sub

Integration_Main_Error:

    MsgBox Err.Description & " (Integration_Main)", vbSystemModal

    Resume Release

End Sub

 
'---------------------------------------------------------------------------------------
' Procedure : m_objHotKeyCloseConnection_HotKeyPressed
' DateTime  : 6/3/2009
' Purpose   : Close ODBC connections on Alt + F6 key press
'---------------------------------------------------------------------------------------
'
Private Sub m_objHotKeyCloseConnection_HotKeyPressed()
 
    On Error GoTo m_objHotKeyCloseConnection_HotKeyPressed_Error
 
    ' Close ODBC Connections
    ODBC2.DestroyConnection
    ODBC3.DestroyConnection
 
    Exit Sub
 
m_objHotKeyCloseConnection_HotKeyPressed_Error:
 
    MsgBox Err.Description & " (m_objHotKeyCloseConnection_HotKeyPressed)", vbSystemModal
 
End Sub

 
'---------------------------------------------------------------------------------------
' Procedure : ShowEntryBox
' DateTime  : 6/3/2009
' Purpose   : Shows User form depending upon datasource
'---------------------------------------------------------------------------------------
'
Public Sub ShowEntryBox()
  
    On Error GoTo ShowEntryBox_Error
 
    If Not g_formEntryBox Is Nothing Then
        ' Show input box modeless
        g_formEntryBox.Show 0
        DoEvents
        Window.SetTopMost g_formEntryBox
        
        With g_formEntryBox.txtValue
            .Text = ""
            .SetFocus
        End With
    End If
    
    Exit Sub
 
ShowEntryBox_Error:
    MsgBox Err.Description & " (ShowEntryBox)", vbSystemModal
End Sub

 
'---------------------------------------------------------------------------------------
' Procedure : UserFormType
' DateTime  : 6/3/2009
' Purpose   : Get/Let User form type
'---------------------------------------------------------------------------------------
'
Public Property Get UserFormType() As Integer
    UserFormType = m_intUserFormType
End Property
 
Public Property Let UserFormType(ByVal intUserFormType As Integer)
    m_intUserFormType = intUserFormType
End Property



